﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data.DataGet;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.ComponentModel;

namespace Business.DataBusiness
{
    public class MucDT
    {
        _MucDT data = new _MucDT();
        private string tenDT;
        private string maDT;
        private string bangTan;
        private string tinhNang;
        private string boNho;
        private string congKetNoi;
        private int soLuong;
        private string thoiGianBH;


        public string TenDT
        {
            get { return tenDT; }
            set { tenDT = value; }
        }
        
        public string MaDT
        {
            get { return maDT; }
            set 
            {
                maDT = value;
                if (maDT == "")
                    throw new Exception("Bạn phải nhập mã điện thoại");
            }
        }
       
        public string BangTan
        {
            get { return bangTan; }
            set { bangTan = value; }
        }
       
        public string TinhNang
        {
            get { return tinhNang; }
            set { tinhNang = value; }
        }
     
        public string BoNho
        {
            get { return boNho; }
            set { boNho = value; }
        }
       
        public string CongKetNoi
        {
            get { return congKetNoi; }
            set { congKetNoi = value; }
        }
       
        public int SoLuong
        {
            get { return soLuong; }
            set 
            {
                soLuong = value;
                if (soLuong <= 0)
                    throw new Exception("Số lượng phải lớn hơn 0");
            }
        }
       
        public string ThoiGianBH
        {
            get { return thoiGianBH; }
            set { thoiGianBH = value; }
        }
       
        public MucDT() { }
        public MucDT(string tendt, string madt, string bangtan, string tinhnang, string bonho, string congketnoi,int soluong,string thoigianbaohanh)
        {
            this.TenDT = tendt;
            this.MaDT = madt;
            this.BangTan = bangtan;
            this.TinhNang = tinhnang;
            this.BoNho = bonho;
            this.congKetNoi = congketnoi;
            this.SoLuong = soluong;
            this.ThoiGianBH = thoigianbaohanh;
        }
        public void Update()
        {
            data.Update_DanhMucDT(this.TenDT, this.MaDT, this.BangTan, this.TinhNang, this.BoNho, this.CongKetNoi, this.SoLuong,this.ThoiGianBH);
        }
        public DataTable DataHangTon()
        {
            return data.DataHangTon();
        }
        public DataTable TimKiemDienThoai(string thongtin)
        {
            return data.TimKiemDienThoai(thongtin);
        }
        
    }
}
